package com.leet.code.lcof;

import com.algorithm.model.TreeNode;
import com.algorithm.model.TreeNodeService;

public class Code27 {

    public static void main(String[] args) {
        TreeNode root = TreeNodeService.getTreeByArray(new int[]{4, 2, 3, 4, 5, 6, 7, 8, 9});


    }

    public TreeNode mirrorTree(TreeNode root) {
        p(root);
        return root;
    }

    public void p(TreeNode node) {
        if (node == null) {
            return;
        }
        TreeNode tmp;
        tmp = node.left;
        node.left = node.right;
        node.right = tmp;

        p(node.left);
        p(node.right);

    }

}
